<?php

class Log
{
	public static function Error( $msg )
	{
		$userName = 'Anonymous';
		
		if ( Auth::IsLoggedIn() )
		{
			$userName = Auth::GetUser()->GetName();
		}
		
		$msg = str_replace( ">", "&gt;", $msg );
		$file = fopen( "log/Error.log", "a" );
		fwrite( $file, Date( "Y-m-d H:i:s" ) . " > " . $userName . " > " . $msg . "\r\n" );
		fclose( $file );
	}
	
	public static function Login( $msg )
	{
		$userName = 'Anonymous';
		
		if ( Auth::IsLoggedIn() )
		{
			$userName = Auth::GetUser()->GetName();
		}
		
		$msg = str_replace( ">", "&gt;", $msg );
		$file = fopen( "log/Login.log", "a" );
		fwrite( $file, Date( "Y-m-d H:i:s" ) . " > " . $userName . " > " . $_SERVER['REMOTE_ADDR'] . " > " . $msg . "\r\n" );
		fclose( $file );
	}
}
